package com.dkm.ec.so.repository.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.repository.AbstractRepository;
import com.dkm.ec.so.domain.SoInvoice;
import com.dkm.ec.so.repository.SoInvoiceRepository;
import com.dkm.ec.so.persistence.dao.SoInvoiceQueryDao;
import com.dkm.ec.so.persistence.entity.SoInvoicePo;

/**
 * 对象功能:订单发票信息 Repository接口的实现类
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-08-01 19:50:12
 */
@Repository
public class SoInvoiceRepositoryImpl extends AbstractRepository<String, SoInvoicePo,SoInvoice> implements SoInvoiceRepository{
	  
	@Resource
	private  SoInvoiceQueryDao soInvoiceQueryDao;

	public SoInvoice newInstance() {
		SoInvoicePo po = new SoInvoicePo();
		SoInvoice soInvoice = SpringHelper.getBean(SoInvoice.class);
		soInvoice.setData(po);
		return soInvoice;
	}

	public SoInvoice newInstance(SoInvoicePo po) {
		SoInvoice soInvoice = SpringHelper.getBean(SoInvoice.class);
		soInvoice.setData(po);
		return soInvoice;
	} 
	
	@Override
	protected IQueryDao<String, SoInvoicePo> getQueryDao() {
		return soInvoiceQueryDao;
	}

	@Override
	public SoInvoicePo findBySoEntityId(String key) {
		Map<String, Object> params = b().a("soEntityId", key).p();
		return soInvoiceQueryDao.getByKey("findBySoEntityId", params);
	}
	
}
